﻿CREATE FUNCTION [dbo].[GetWeekNumber]
(@date DATE)
RETURNS INT
AS
begin
  declare @weekNo int
  select top 1 @weekNo = WeekNumber from dbo.Weeks
  where @date > StartDate
  order by StartDate desc
  return @weekNo
  end

